import { uni_promisify } from "./promiseify"

export const hyh_getSetting = uni_promisify(uni.getSetting)

export const hyh_openSetting = uni_promisify(uni.openSetting)

export const hyh_getPushClientId = uni_promisify(uni.getPushClientId)

export const hyh_hasPermission = async (permission) => {
	const res = await hyh_getSetting()
	return res.authSetting?.[permission]
}

export const hyh_authorize = (scope) => uni_promisify(uni.authorize)({scope})

export const hyh_showModal = (options) => uni_promisify(uni.showModal)(options).then(res => res.confirm)

export const wx_login = (options) => uni_promisify(uni.login)(options)

export const wx_requestSubscribeMessage = (options) => uni_promisify(wx.requestSubscribeMessage)(options)
